package hessian2_consumer

import (
	"context"
	"dubbo.apache.org/dubbo-go/v3/config"
	_ "dubbo.apache.org/dubbo-go/v3/imports" // dubbogo 框架依赖，所有dubbogo进程都需要隐式引入一次
	config2 "gitee.com/youbeiwuhuan/dubbo-go-proj/hessian2-example/hessian2-consumer/config"
	hessian2_iface "gitee.com/youbeiwuhuan/dubbo-go-proj/hessian2-example/hessian2-iface"
	"google.golang.org/appengine/log"
)

// export DUBBO_GO_CONFIG_PATH=dubbogo.yml 运行前需要设置环境变量，指定配置文件位置
func main() {
	// 启动框架
	if err := config.Load(config.WithBytes(config2.DubbogoYml)); err != nil {
		panic(err)
	}
	var i int64 = 1
	// 发起调用
	user, err := hessian2_iface.UserProviderClient.GetUser(context.TODO(), i)
	if err != nil {
		panic(err)
	}
	log.Infof(context.Background(), "response result: %+v", user)
}
